Skip to content

Instantly share code, notes, and snippets.

@adtac
adtac / Dockerfile
Last active May 28, 2024 01:38
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@tekin
tekin / .gitattributes
Last active February 23, 2024 16:46
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
@DBraun
DBraun / new_renderman.py
Last active April 8, 2022 19:01
New RenderMan proposal
import numpy as np
from scipy.io import wavfile
import librosa
import renderman as rm
SAMPLE_RATE = 44100
BUFFER_SIZE = 512
REVERB_PLUGIN = "C:/path/to/reverb.dll"
SYNTH_PLUGIN = "C:/path/to/synth.dll"
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Red Bull X-Alps 2019 Route</name>
<snippet>https://www.redbullxalps.com/ Created by twpayne@gmail.com</snippet>
<open>1</open>
<Folder>
<name>Route</name>
<Placemark>
<LineString>
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active May 15, 2024 20:55
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active May 6, 2024 08:10
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@ccstone
ccstone / Raw_AppleScript_Event_Codes_2006.tsv
Last active May 10, 2024 15:46
Raw AppleScript Event Codes (2006)
Code Terminology Kind Usage Line
$scr scripting additions folder Property of class: domain System Events : Disk-Folder-File Suite 1
%doc music folder Property of class: user domain object System Events : Disk-Folder-File Suite 2
µdoc music folder Enumeration Standard Additions : File Commands 3
ƒhlp help Enumeration Standard Additions : File Commands 4
ƒhlp help folder Enumeration Standard Additions : File Commands 5
ƒlib shared libraries Enumeration Standard Additions : File Commands 6
ƒlib shared libraries folder Enumeration Standard Additions : File Commands 7
ƒmod modem scripts Enumeration Standard Additions : File Commands 8
ƒmod modem scripts folder Enumeration Standard Additions : File Commands 9
@TRex22
TRex22 / useful_ruby_rails_console_tricks.md
Last active March 18, 2024 14:08
Useful Ruby/Rails console tricks

Get all records in state

Rails.application.eager_load!
ActiveRecord::Base.subclasses(&:name)

Get last console output

variable = _

Run a rails console in Sandbox mode

@bushev
bushev / ssh-tunnel-ios.md
Last active September 23, 2022 10:39
How to hide IP address without of VPN on iOS for free

In order to tunnel all iOS Internet traffic using SSH:

  1. Get this app: SSHTunnel
  2. Create a tunnel with type "Dynamic" & connect.
  3. Click on the config.pac file to copy it to a clipboard.
  4. Go to Settings > General > Network > Wi-Fi and tap the blue arrow on the right side of the entry for your network. Scroll down to the "Proxy" section and tap "Auto". Paste URL to a pac file from a clipboard.
  5. Have a FUN!

See a detailed video: https://www.youtube.com/watch?v=8r0eEr36Dg4