Skip to content

Instantly share code, notes, and snippets.

@brianleroux
brianleroux / wtf-sns-apns.js
Created August 5, 2016 23:00
Send a silent push notification to APNS with AWS SNS.
sns.publish({
TargetArn: device.arn,
MessageStructure: 'json',
Message: JSON.stringify({
default: 'you will never see this muah!',
APNS_SANDBOX: JSON.stringify({
aps: {
'alert': '',
'content-available': 1
},
@pahaz
pahaz / google_spreadsheets_create_update_example.py
Created July 15, 2016 13:31
Python Google spreadsheets v4 API example. Google spreadsheet access management example. Use google drive v3 API for access management
"""Google spreadsheet related.
Packages required: oauth2client, google-api-python-client
* https://gist.github.com/miohtama/f988a5a83a301dd27469
"""
from oauth2client.service_account import ServiceAccountCredentials
from apiclient import discovery
def get_credentials(scopes: list) -> ServiceAccountCredentials:
@itsrifat
itsrifat / extract_frames.cpp
Last active July 13, 2023 18:48
simple c++ functions to extract frames of a video file into a vector of Mat and saving the vector as jpg images using OpenCV 2.4.9
/*
This functions opens a video file and extracts the frames and put them into a vector of Mat(its the class for representing an img)
*/
void extract_frames(const string &videoFilePath,vector<Mat>& frames){
try{
//open the video file
VideoCapture cap(videoFilePath); // open the video file
if(!cap.isOpened()) // check if we succeeded
CV_Error(CV_StsError, "Can not open Video file");
@Kuranes
Kuranes / sketchab-cpp-libcurl
Last active June 11, 2023 16:54
simple https upload from c++ multi-plateform code using libcurl library
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
struct MemoryStruct {
char *memory;
size_t size;
};
@Ginny
Ginny / HomeActivity.java
Created April 24, 2012 17:01
Listview without extending ListActivity because of actionbar
public class HomeActivity extends MyActionBar {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayList<String> events = new ArrayList<String>();
events.add("Birthday party");
events.add("Epic party");
@jhasse
jhasse / main.cpp
Created May 25, 2011 10:18
SHA-1 With Boost
#include <iostream>
#include <boost/uuid/sha1.hpp>
void display(char* hash)
{
std::cout << "SHA1: " << std::hex;
for(int i = 0; i < 20; ++i)
{
std::cout << ((hash[i] & 0x000000F0) >> 4)
<< (hash[i] & 0x0000000F);