Skip to content

Instantly share code, notes, and snippets.

@mmlac
mmlac / ConsoleApplication.cpp
Last active August 5, 2023 14:53
[C++ & C# Examples] Getting the existing processes running on the system and their modules - Written & Tested in VS2015
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <psapi.h>
#include <list>
#include <algorithm>
#include <string>
#include <cctype>
#include <sstream>
// compile with: clang++ main.cpp -o image_exmple -lSDL2 -lSDL2_image
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <cstdio>
#include <string>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
SDL_Window *window = NULL;
@deinspanjer
deinspanjer / test_a_sayer.go
Created November 9, 2016 16:25 — forked from anonymous/test_a_sayer.go
Example of cross-package interfaces in golang
package a
import "fmt"
type Sayer interface {
Say() string
}
type Formal struct{}
@damieng
damieng / download-with-fetch.flow.js
Last active April 13, 2023 01:17
Download a file with progress indication using just window.fetch + node (FlowType version)
// @flow
import fs from 'fs';
// Public: Download a file and store it on a file system using streaming with appropriate progress callback.
//
// * `sourceUrl` Url to download from.
// * `targetFile` File path to save to.
// * `progressCallback` Callback function that will be given a {ByteProgressCallback} object containing
// both bytesDone and percent.
@javilobo8
javilobo8 / download-file.js
Last active March 17, 2025 14:25
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@psqq
psqq / main.cpp
Last active September 15, 2024 04:07
Simple SDL_net example
#include <SDL.h>
#include <SDL_net.h>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
if (SDL_Init(0) == -1) {
printf("SDL_Init: %s\n", SDL_GetError());
@cyaoeu
cyaoeu / fbx_batchexport_anims.py
Created August 29, 2017 17:57
Blender script: batch export anims
import bpy
path = bpy.path.abspath('//') #path of .blend
objname = bpy.context.active_object.name #select rig
singleanim = True
if singleanim == True:
action = bpy.context.active_object.animation_data.action
@santosh
santosh / senduseragent.py
Created November 2, 2017 07:12
Return back user agent in Flask. #Python
from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def index():
user_agent = request.headers.get('User-Agent')
return '<p>Your browser is {}!</p>'.format(user_agent)
@app.route('/user/<name>')
def user(name):
@mbinna
mbinna / effective_modern_cmake.md
Last active April 25, 2025 22:01
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@gfriloux
gfriloux / Cargo.toml
Created December 12, 2017 14:49
Streaming data
[package]
name = "chunked"
version = "0.1.0"
authors = ["Guillaume Friloux <[email protected]>"]
[dependencies]
rocket = "0.3.3"
rocket_codegen = "0.3.3"
rocket_contrib = "0.3.3"