Skip to content

Instantly share code, notes, and snippets.

View Lewiscowles1986's full-sized avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile
@say4n
say4n / USAGE.md
Last active October 23, 2016 15:34
Python basic time profiler

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 06:37
Just a plain simple boring xkcd comic downloader with download progress indicator.
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 January 22, 2013 23:28
Create a 48bit integer suitable for use with pack() in PHP
<?php
$topUp = 100;
list($integerPart1, $integerPart2) = convertTo48bit($topUp);
$packedInteger = pack("vV", $integerPart1, $integerPart2);
echo json_encode($packedInteger) . "\n";
@honktang
honktang / web-snippet-055 ( upload to Imgur in JavaScript)
Created June 14, 2017 06:14 — 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!
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>");
#!/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
@freekmurze
freekmurze / bookmarklet
Last active February 22, 2019 10:13
Oh Dear! Reachable bookmarklet
javascript:{window.location='https://ohdear.app/tools/reachable?prefill='+encodeURIComponent(window.location.href)}
@Lewiscowles1986
Lewiscowles1986 / ra-7601U-USB-build-inst.sh
Last active September 3, 2019 23:31
install ralink 7601U USB N+150 wireless driver (Ubuntu 14.04 or Kernel 3.13+)
#!/bin/sh
#setup dependencies
sudo apt-get install --reinstall linux-headers-generic build-essential
#get patched drivers
wget http://www.lewiscowles.co.uk/dls/MT7601U-14.04-patched.tar -O - | tar -x
cd MT7601U-14.04-patched
# build and install
node {
try{
notifyBuild('STARTED')
bitbucketStatusNotify(buildState: 'INPROGRESS')
ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/") {
withEnv(["GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"]) {
env.PATH="${GOPATH}/bin:$PATH"
stage('Checkout'){
@johnmcfarlane
johnmcfarlane / functor.c
Last active May 3, 2020 17:08
Illustrates run-time polymorphism in C
// functor.c : Illustrates run-time polymorphism in C.
//
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
////////////////////////////////////////////////////////////////////////////////
// APIs
@Lewiscowles1986
Lewiscowles1986 / dhcpcd.sh
Created August 21, 2017 16:00
Raspberry pi stretch allow dhcpcd5 with /etc/network/interfaces
#!/bin/sh -e
#
# This file belongs in /usr/lib/dhcpcd5/dhcpcd how you get it there is up to you
#
DHCPCD=/sbin/dhcpcd
INTERFACES=/etc/network/interfaces
REGEX="^[[:space:]]*iface[[:space:]](*.*)[[:space:]]*inet[[:space:]]*(dhcp|static)"
EXCLUDES=""