Skip to content

Instantly share code, notes, and snippets.

View miron's full-sized avatar
🧘‍♂️
Smashing Python for Fun and Profit

Miron miron

🧘‍♂️
Smashing Python for Fun and Profit
View GitHub Profile
@russjones
russjones / run.sh
Last active September 23, 2022 14:57
A script to demonstrate Teleport Enhanced Session Recording.
#!/bin/bash
set -euo pipefail
RELEASE="teleport-v4.2.3-linux-amd64-bin.tar.gz"
if [[ $EUID -ne 0 ]]; then
echo "--> Please run this script as root or sudo."
exit 1
fi
@cerebrate
cerebrate / README.md
Last active December 2, 2023 08:17
Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

WARNING

THIS GIST IS EXTREMELY OBSOLETE. DO NOT FOLLOW THESE INSTRUCTIONS. SERIOUSLY.

IF YOU IGNORE THE ABOVE WARNING, YOU AGREE IN ADVANCE THAT YOU DIDN'T GET THESE INSTRUCTIONS FROM ME, THAT I WARNED YOU, AND THAT I RESERVE THE RIGHT TO POINT AND LAUGH MOCKINGLY IF AND WHEN SOMETHING BREAKS HORRIBLY.

I'll do a write-up of current custom-kernel procedures over on Random Bytes ( https://randombytes.substack.com/ ) one day soon.

NOTE

@jtwyles
jtwyles / dema.py
Last active August 19, 2023 18:23
Calculate EMA(EMA) and DEMA in Python
#
# See how to use this script and what type of input to use at:
# https://steemit.com/trading/@jwyles/ema-ema-and-dema-how-to-calculate-using-python-and-spreadsheets
#
# This gist is an extension of this other gist:
# https://gist.github.com/jtwyles/517becb2deebf9e3b2874d8c26c4c99f
#
import csv
import re
@nihal111
nihal111 / ntp_update_time.py
Last active December 21, 2023 17:01
A python script to update system time in Windows by attempting to fetch time from multiple NTP servers from a defined list.
import socket
import struct
import sys
import time
import datetime
import win32api
# List of servers in order of attempt of fetching
server_list = ['ntp.iitb.ac.in', 'time.nist.gov', 'time.windows.com', 'pool.ntp.org']
@konstantinfarrell
konstantinfarrell / fizzbuzz.py
Created June 28, 2016 20:42
FizzBuzz one-liner in Python 3
# Using a lambda function
print(list(map(lambda i: "Fizz"*(i%3==0)+"Buzz"*(i%5==0) or str(i), range(1,101))))
# Using a for loop
for i in range(1, 101): print("Fizz"*(i%3==0)+"Buzz"*(i%5==0) or str(i))
@awesomebytes
awesomebytes / ipython_to_file.md
Created March 16, 2016 10:38
Save iPython session to a python file as code

Save an iPython session commands/code to a file

You must use the magic method %save:

In [1]: %save?
Type:       Magic function
String Form:<bound method CodeMagics.save of <IPython.core.magics.code.CodeMagics object at 0x7fb5d25bb1d0>>
Namespace:  IPython internal
File: /usr/lib/python2.7/dist-packages/IPython/core/magics/code.py
@ywangd
ywangd / psiclient.py
Last active April 10, 2020 16:32
Proof-of-Concept Client for Pythonista-Script-Index
"""
Basic client for Pythonista Script Index (https://github.com/ywangd/Pythonista-Script-Index)
See also: https://github.com/ywangd/psiclient
"""
import platform
import sys
import os
import urllib2
import json
// add this to <profile>/static/custom/custom.js to load vim keybindings:
$.getScript("/static/components/codemirror/keymap/vim.js", function() {
if (! IPython.Cell) return;
IPython.Cell.options_default.cm_config.keyMap = "vim";
});
anonymous
anonymous / Pypi.py
Created March 26, 2013 04:46
Pypi
import urllib
import tarfile
import shutil
import console
import os
class Installer(object):
name = None
version = None
firstLetter = None
@silverkors
silverkors / fileman.py
Created November 27, 2012 20:40
Useful filemanager for Pythonista, move files, delete and create files and directories
# -*- coding: utf-8 -*-
import os, sys, editor, shutil
from glob import glob
from scene import *
from time import time
from copy import deepcopy
from PIL import Image, ImageDraw, ImageFont
# https://gists.github.com/4034526