Skip to content

Instantly share code, notes, and snippets.

View lyf-is-coding's full-sized avatar
💓
Live Laugh Love

lyf-is-coding

💓
Live Laugh Love
View GitHub Profile
@creativcoder
creativcoder / gist:5dc5c2e35cd218ce9b5d
Last active August 22, 2022 14:41
Get list of installed packages(apps) in android via adb shell
Issue this command to terminal with your device connected :
$ adb shell pm list packages
If that doesn't work, then:
$ adb shell
$ su
$ pm list packages
@JasonMore
JasonMore / async.cs
Created June 3, 2014 20:31
HttpWebRequest sync/async
public async Task<string> GetResponseAsStringAsync(HttpWebRequest webRequest, string post = null)
{
if (post != null)
{
webRequest.Method = "POST";
using (Stream postStream = await webRequest.GetRequestStreamAsync())
{
byte[] postBytes = Encoding.ASCII.GetBytes(post);
await postStream.WriteAsync(postBytes, 0, postBytes.Length);
await postStream.FlushAsync();
@willurd
willurd / web-servers.md
Last active May 16, 2025 23:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@bazub
bazub / gist:3877971
Created October 12, 2012 08:17
Grayscale/Binary images using PIL
im=Image.open("1.jpg")
#im=im.rotate(1)
im.save("e.jpg")
im2=im.convert("L")
im2.save("b.jpg")
threshold = 100
im = im2.point(lambda p: p > threshold and 255)
im.save("d.jpg")
img="d.jpg"
result = tesseract.ProcessPagesWrapper(img,api)
@matthiasr
matthiasr / pack.c
Created May 1, 2011 18:54
Small test program to test #pragma pack(...) support
#include <stdio.h>
#pragma pack(push)
#pragma pack(1)
struct {
char a;
int b;
char c;
} packed;
#pragma pack(pop)