Skip to content

Instantly share code, notes, and snippets.

View ubershmekel's full-sized avatar
🤙
What's a github status?

Yuval Greenfield ubershmekel

🤙
What's a github status?
View GitHub Profile
@ubershmekel
ubershmekel / sorttables.js
Last active January 12, 2024 06:00
Sort tables bookmarklet
/*
SortTable
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
Instructions:
Download this file
Add <script src="sorttable.js"></script> to your HTML
Add class="sortable" to any table you'd like to make sortable
@ubershmekel
ubershmekel / mark_errors_bookmarklet.js
Created June 23, 2016 16:49
Bookmark this and all the instances of errors and warnings on the page will be highlighted
javascript:(function(){var s=document.createElement('script');s.src='https://cdnjs.cloudflare.com/ajax/libs/mark.js/7.0.0/mark.min.js';s.onload=function(){(new Mark(document.body)).mark(["err", "warn", "fail", "exception"])};document.head.appendChild(s);})()
@ubershmekel
ubershmekel / ibeforeeexceptafterc.py
Created September 25, 2016 04:35
Counting how many times "I before E except after C" is correct
"""
Inspired by this bogus TIL: https://www.reddit.com/r/todayilearned/comments/54c05w/til_there_are_923_words_in_the_english_language/
Downloaded this corpus: https://sourceforge.net/projects/wordlist/files/SCOWL/2016.06.26/scowl-2016.06.26.zip/download?use_mirror=pilotfiber
From http://wordlist.aspell.net/
SCOWL (Spell Checker Oriented Word Lists)
The results of running this script are:
@ubershmekel
ubershmekel / TimeoutServer.py
Created October 18, 2016 23:29
Just for when you need a socket to always timeout
# Echo server program
import socket
import time
# Symbolic name meaning all available interfaces
HOST = ''
# Arbitrary non-privileged port
PORT = 18080
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
@ubershmekel
ubershmekel / HtmlJsAlerts.html
Last active December 23, 2016 22:10
Just paste this (probably minify it first) and get red alerts at the bottom of the page when errors occur
<style>
/* This is my error handler to show myself and users when errors are happening */
/* See: https://gist.github.com/ubershmekel/66abb3987b116b4824201f9cd72e1dd9 /*
/* style from http://www.w3schools.com/howto/howto_js_snackbar.asp */
/* The snackbar - position it at the bottom and in the middle of the screen */
#snackAlertsContainer {
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
bottom: 30px; /* 30px from the bottom */
width: 100%;
@ubershmekel
ubershmekel / CodeCollabReviewShellExtension.reg
Created January 18, 2017 00:27
Code Collaborator Code Review Shell Extension, start a review from a folder in windows explorer
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\ccollab]
@="CodeCollab Review"
"Icon"="\"C:\\Program Files\\Collaborator Client\\ccollab.exe\""
[HKEY_CLASSES_ROOT\Directory\shell\ccollab\command]
@="\"C:\\Program Files\\Collaborator Client\\ccollab.exe\" addchanges ask %V"
[HKEY_CLASSES_ROOT\Directory\Background\shell\ccollab]
@ubershmekel
ubershmekel / concat.py
Created January 22, 2017 23:06
Concatenate a few video files into one with ffmpeg
"""
Concatenate a few video files into one with ffmpeg
Use a wild card
"""
import subprocess
import glob
import re
to_concat = 'robocar*'
@ubershmekel
ubershmekel / windows_keys.py
Last active October 18, 2021 07:04
Simple unicode keyboard automation for windows
# coding: utf-8
import ctypes
import time
import sys
LONG = ctypes.c_long
DWORD = ctypes.c_ulong
ULONG_PTR = ctypes.POINTER(DWORD)
WORD = ctypes.c_ushort
@ubershmekel
ubershmekel / pile.py
Created March 8, 2017 19:53
Pile of images positioned randomly
import glob
import random
from PIL import Image
from tqdm import tqdm
images = glob.glob('pngs2/*.png')
width = 700
height = 700
@ubershmekel
ubershmekel / open_sgn.py
Created June 22, 2017 00:00
How to open .sgn file types from Israeli Courts
#!/usr/bin/python
"""
court.gov.il for some reason send out these signed files with the "sgn" file extension.
They're xml files with base64 encoded contents, this is how you can get them out.
open_sgn.py myfile.sgn
"""
import base64