Skip to content

Instantly share code, notes, and snippets.

View CypherpunkSamurai's full-sized avatar
😶
Currently Busy 🌻🐢

Cypherpunk Samurai CypherpunkSamurai

😶
Currently Busy 🌻🐢
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ace custom autocomplete test</title>
<script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js"></script>
<script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/ext-language_tools.js"></script>
<style>
body {
overflow: hidden;
<html>
<!-- Head !-->
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Title !-->
<title></title>
@CypherpunkSamurai
CypherpunkSamurai / test.cpp
Created July 28, 2021 15:03 — forked from FatalCatharsis/test.cpp
A poco http example
Poco::JSON::Object obj;
obj.set("name", "blah");
obj.set("language", "english");
Poco::URI uri("http://the-uri-you-want-to-request-from");
std::string path(uri.getPathAndQuery());
if (path.empty()) path = "/";
HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest request(HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1);
@CypherpunkSamurai
CypherpunkSamurai / poco_http_post_headers.cpp
Created July 28, 2021 15:03 — forked from jeffcrouse/poco_http_post_headers.cpp
Poco HTTPPOST request with headers
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/StreamCopier.h>
#include <Poco/Path.h>
#include <Poco/URI.h>
#include <Poco/Exception.h>
using namespace Poco::Net;
using namespace Poco;
@CypherpunkSamurai
CypherpunkSamurai / bencode.cpp
Created August 10, 2021 19:39 — forked from caetanus/bencode.cpp
Qt Bencode and Decoder and Torrent Creator
#include "bencode.h"
BEncode::BEncode()
: m_decodeError{ false }
{
}
QByteArray BEncode::encode(QVariant value)
{
return encodeVariant(value);
@CypherpunkSamurai
CypherpunkSamurai / gtk3-dynamic-image-size.md
Last active May 30, 2022 20:08
GTK3 Dynamically Resizing Images

GTK3 Dynamically Resizing Images

While using gotk3 I came across this problem of resizing images to fit the container. As @diamondburned explained gdk pixbufs are statically the same size as the original image. Then if I want different sizes I will have to resize it.

Searching for resources

I began searching for resources and i found these incredible sources:

@CypherpunkSamurai
CypherpunkSamurai / reverse-an-array-golang.md
Last active September 30, 2021 09:32
Reversing a String in Golang

Reverse an Array in Golang

This example shows how to reverse an array in golang. You can use this in your stringutils.go file for your projects

In this example we use an array of strings. the array type can be of anything but same type

The source array

@CypherpunkSamurai
CypherpunkSamurai / slices-and-arrays.md
Created September 30, 2021 09:21
Slices and Arrays in Golang

Slices and Arrays in Golang

This gist explains difference between arrays and slices in Golang

Usually what we understand with an array is that it stores objects with same types in locations called indexes (starting at 0).

so, [1,2,3,4,5] contains numbers (integers) from 1 to 5. each of them at indexes 0,1,2,3,4 respectively.

In golang there are two types of arrays like other languages.

apply plugin: 'com.android.application'
android {
...
...
defaultConfig {
...
versionCode 2000
...
@CypherpunkSamurai
CypherpunkSamurai / get_latest_release.sh
Created October 3, 2021 17:52 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4