Skip to content

Instantly share code, notes, and snippets.

View Stormix's full-sized avatar
🧙
Hippity hoppity your code is now my property.

Anas Mazouni Stormix

🧙
Hippity hoppity your code is now my property.
View GitHub Profile
// kills long running ops in MongoDB (taking seconds as an arg to define "long")
// attempts to be a bit safer than killing all by excluding replication related operations
// and only targeting queries as opposed to commands etc.
killLongRunningOps = function(maxSecsRunning) {
currOp = db.currentOp();
for (oper in currOp.inprog) {
op = currOp.inprog[oper-0];
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) {
print("Killing opId: " + op.opid
@brandoncurtis
brandoncurtis / AnalogReadSerial.ino
Last active January 29, 2024 20:47
Realtime Data Acquisition and Plotting with Arduino and Python
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
Upload this to the Arduino using the Arduino IDE!
*/
@tomysmile
tomysmile / mac-setup-redis.md
Last active October 31, 2024 21:46
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@petercossey
petercossey / ubuntu-powerline-install.md
Last active July 12, 2022 12:44
Powerline font install for Ubuntu 16.10 (also confirmed working for 17.04, 17.10, 18.04, 19.10)

Install Powerline fonts for Z shell

Please note: there is an APT package called "fonts-powerline" which is tested and working for Ubuntu 20.04 which achieves the same outcome. Try "sudo apt install fonts-powerline"

If you're using Z Shell and a special prompt theme designed with Powerline fonts in mind, you'll need to install them on your machine. These are the most clear and cut-down instructions that I've found to work with Ubuntu 16.10 (also confirmed working for 17.04, 17.10, 18.04, 19.10) and all credit goes to renshuki's Ubuntu 14.04 + Terminator + Oh My ZSH with Agnoster Theme gist. I've extracted just the Powerline font instructions - my personal setup uses Prezto instead of Oh My ZSH (not included here).

Get the font and config files

cd ~
anonymous
anonymous / InfoMathIsmail.py
Created April 27, 2017 20:12
import math
def lairalgebriqueapproximationrectangle():
A=input("Entrez la forme de la fonction avec variable x : ")
print('f(x)=',A)
n=int(input("Entrez le nombre de pas n ,de préference il doit etre grand : "))
a=float(input("l'intervalle commence de : "))
b=float(input("l'intervalle fini par : "))
somme=0
for k in range(0,n):
fonction=''
@traumverloren
traumverloren / style.css
Last active January 7, 2024 14:05
VSCode Customizations for Operator Mono, Fira Code, and Dark Candy Theme
/*
Instructions for MacOS:
- Install the fonts 'Operator Mono' & 'Fira Code'
- Install theme 'Dark Candy'
- Add the following config to the VS Code settings.json:
{
"editor.renderWhitespace": "all",
"editor.fontSize": 14,
@jesgs
jesgs / deploying-from-github-to-vps-using-travis-ci.md
Last active October 27, 2024 12:27
Deploying from Github to VPS using Travis CI

From: https://www.jesgs.com/blog/2017/12/18/deploying-from-github-to-vps-using-travis-ci

Recently, I spent around 14 to 16 hours learning all of the necessary steps to getting an existing repo set up with Travis CI to run unit tests, and then once successful, connect to a remote server that isn't a PaaS (in this case, Linode) and then proceeds to use Git hooks to do post deployment things.

Starting with your local machine and you have your project already checked out from Github.

Setting Up

  • Assuming you have Ruby (at least 2.3.1) installed, run gem install travis. This installs the Travis CI command-line tools. We're going to use these tools to encrypt RSA keys that Travis will use to connect to your remote server.
  • This tutorial also assumes that you have a working repo and a Travis-CI account set up.
@Stormix
Stormix / bootstrap.ts
Last active May 30, 2020 10:41
Laravel SPA token mismatch 419
import axios from 'axios'
import createAuthRefreshInterceptor from 'axios-auth-refresh'
const getCSRFToken = () => {
const token: HTMLMetaElement | null = document.head.querySelector(
'meta[name="csrf-token"]'
)
return token?.content
}
@rexim
rexim / emoteJAM.md
Last active May 2, 2021 09:25
emoteJAM Elevator Pitch Document

emoteJAM

emoteJAM is a simple website that generates animated BTTV emotes from static images.

That idea is to apply a well established "meme meta filters" to static emotes. Such as JAM, Hop, etc.

The most important feature of the website is that it's completely client-side and can be easily deployed to something like GitHub Pages. It uses WebGL to animate static images and gif.js to generate actual GIF files inside of your browser.

The project is currently in development and not available to general public until it's more or less feature-complete.