Skip to content

Instantly share code, notes, and snippets.

View enwi's full-sized avatar
👻

Moritz Wirger enwi

👻
View GitHub Profile
@Bouni
Bouni / lcsc.py
Last active June 9, 2023 15:12
LCSC API python example
from pprint import PrettyPrinter
import requests
pp = PrettyPrinter()
def query(number)
url = f"https://wwwapi.lcsc.com/v1/products/detail?product_code={number}"
r = requests.get(url)
pp.pprint(r.json())
@Bolukan
Bolukan / Aliexpress_items.user.js
Last active July 28, 2023 14:17
Aliexpress_items
// ==UserScript==
// @name Extract AliExpress Order Detail Pages
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Extract the contents from AliExpress order detail pages, while also removing all svg tags
// @author You
// @match https://www.aliexpress.com/p/order/detail.html*
// @grant none
// ==/UserScript==
@IAmSuyogJadhav
IAmSuyogJadhav / Transparent drawings in OpenCV.py
Created July 10, 2018 09:41
Add transparency to rectangles, circles, polgons, text or any shape drawn in OpenCV.
import cv2
image = cv2.imread('test.jpg')
overlay = image.copy()
x, y, w, h = 10, 10, 10, 10 # Rectangle parameters
cv2.rectangle(overlay, (x, y), (x+w, y+h), (0, 200, 0), -1) # A filled rectangle
alpha = 0.4 # Transparency factor.
@NathanWalker
NathanWalker / animate.directive.ts
Last active January 21, 2019 01:09
NativeScript for Angular animate directive for silky smooth mobile (iOS/Android) animations anytime, anywhere and on anything.
/**
* Add this to your app's SharedModule declarations
*/
import { Directive, ElementRef, Input } from '@angular/core';
// nativescript
import { View } from 'tns-core-modules/ui/core/view';
import { Animation, AnimationDefinition } from 'tns-core-modules/ui/animation';
@hostilefork
hostilefork / listener.c
Last active July 19, 2024 02:55
Simple listener and sender for UDP multicast
//
// Simple listener.c program for UDP multicast
//
// Adapted from:
// http://ntrg.cs.tcd.ie/undergrad/4ba2/multicast/antony/example.html
//
// Changes:
// * Compiles for Windows as well as Linux
// * Takes the port and group on the command line
//
@0x263b
0x263b / colors.md
Last active July 13, 2024 19:15
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@brianloveswords
brianloveswords / git-obliterate
Last active January 24, 2024 12:28
git-obliterate: for removing sensitive files you may have committed from the entire history of the project.
#!/bin/bash
file=$1
test -z $file && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
git ignore $file
git add .gitignore
git commit -m "Add $file to .gitignore"