Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile
@mchiron
mchiron / wordpress media template modify
Created Apr 2, 2015
I am sure there is a special place in hell for doing what I just did, but it work for what was needed. Pushing code manually with javascript into the wp media template...
View wordpress media template modify
add_action('print_media_templates', function() {
?>
<script>
var el = document.getElementById('tmpl-attachment');
var pos = el.outerHTML.indexOf('<# } else if ( \'image\' === data.type && data.sizes ) { #>');
var text = '<# } else if ( \'svg+xml\' === data.subtype ) { #>\n' +
'<div class="centered">\n' +
'<img src="{{ data.url }}" class="thumbnail" draggable="false" />\n' +
'</div>\n' +
@say4n
say4n / USAGE.md
Last active Oct 23, 2016
Python basic time profiler
View USAGE.md

To use the profiler, just use import pyprofile and if the function to be profiled is named stupid_code use the profiler as follows

@pyprofile
def stupid_code():
    # do something stupid here
@say4n
say4n / LICENSE
Last active May 9, 2017
Just a plain simple boring xkcd comic downloader with download progress indicator.
View LICENSE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Sayan Goswami <goswami.sayan47@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bigcalm
bigcalm / 48bit_test1.php
Created Jan 22, 2013
Create a 48bit integer suitable for use with pack() in PHP
View 48bit_test1.php
<?php
$topUp = 100;
list($integerPart1, $integerPart2) = convertTo48bit($topUp);
$packedInteger = pack("vV", $integerPart1, $integerPart2);
echo json_encode($packedInteger) . "\n";
@cole007
cole007 / freelance-2014.csv
Last active Oct 4, 2017
Freelance Rates 2014 (@asclearasmud)
View freelance-2014.csv
Where are you based in the UK? How would you describe what you do? Is your primary skill set(s) How old are you? How many years have you been a web professional? How many years have you been freelance? What is your DAY (not hourly) rate? DAY RATE (clean) What is your HOUR (not daily) rate? HOUR RATE (clean) How do you primarily charge clients? Do you normally request a deposit before starting work on a project? Do you normally use a contract? Do you mostly work … What is the average value of projects you work on? What is your gender? Do you primarily charge a fixed rate or does your rate vary between clients? What is the average amount of time spent working on a project? How many projects do you tend to work on at any on time? What is your normal invoicing terms? Where do you primarily work? On average, how many hours a day do you normally work? On average, how many days a week do you normally work? Do you have an accountant? What accounting software do you use, if any? Accounting software (clean) Is fr
@honktang
honktang / web-snippet-055 ( upload to Imgur in JavaScript)
Created Jun 14, 2017 — forked from achudars/web-snippet-055 ( upload to Imgur in JavaScript)
Use JavaScript to upload anonymously to Imgur using Imgur API and show the link to the file. Make sure your API key is valid and working!
View web-snippet-055 ( upload to Imgur in JavaScript)
function upload(file) {
var imageLink ="";
/* Is the file an image? */
if (!file || !file.type.match(/image.*/)) return;
var fd = new FormData();
fd.append("image", file); // Append the file
fd.append("key", "<Imgur API key>");
View gcov-coveralls.sh
#!/bin/bash
pushd .
dir=$(pwd)
cd $2
$1 --preserve-paths --relative-only $(find $dir/$3 -iname "*.gcda") >/dev/null
echo "#!/usr/bin/python
import json,sys,codecs
View Windows calc.exe Shellcode
[SECTION .text]
global _start
_start:
jmp short getData
execIt:
pop ebx ;Get the string off stack
xor eax,eax ;Clear eax
mov [ebx+8],al ;This helps us to avoid having a zero byte in our code.
;It sets the terminator to the string.
push eax ;Second argument for WinExec
@freekmurze
freekmurze / bookmarklet
Last active Feb 22, 2019
Oh Dear! Reachable bookmarklet
View bookmarklet
javascript:{window.location='https://ohdear.app/tools/reachable?prefill='+encodeURIComponent(window.location.href)}
View freeze.md

Freezer cgroup FTW

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.