Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

sagar sagar290

🏠
Working from home
View GitHub Profile
View NewsFeeder.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"github.com/gocolly/colly"
)
View tsconfig.json
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"lib": ["dom", "es2017", "esnext.asyncIterable"],
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"removeComments": true,
"noImplicitAny": true,
View tries.go
package main
import "fmt"
// AlphabteSize is the number of posible characters in tries
const AlphabteSize = 26
// Node represents the each node in the tries
type Node struct {
children [AlphabteSize]*Node
View hashtable.go
package main
import "fmt"
const ArraySize = 7
// has table hold the array
type HashTable struct {
array [ArraySize]*Bucket
}
@sagar290
sagar290 / wc_order_status_changes.php
Created Jul 3, 2021 — forked from abegit/wc_order_status_changes.php
WooCommerce Hooks for Order Status Changes
View wc_order_status_changes.php
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
@sagar290
sagar290 / Makefile
Created May 28, 2021 — forked from PhirePhly/Makefile
A crazy simple SMTP server, for educational purposes only.
View Makefile
default:
cc ccsmtp.c -o ccsmtpd -lpthread
@sagar290
sagar290 / s3_policy.json
Created Apr 24, 2021
for public policy
View s3_policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
@sagar290
sagar290 / alter-user.sql
Created Apr 15, 2021 — forked from backslash112/alter-user.sql
Blog: Start a Remote MySQL Server with Docker quickly
View alter-user.sql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '<password>';
@sagar290
sagar290 / mamp-sql-dump-export.sh
Created Feb 25, 2021 — forked from oliveratgithub/mamp-sql-dump-export.sh
MAMP MySQL dump export using Terminal.app in macOS
View mamp-sql-dump-export.sh
$ cd /Applications/MAMP/Library/bin/
$ ./mysqldump --host=localhost -uroot -proot source_database > ~/Desktop/database_name-dump.sql
View handlefunc.go
package main
import (
"io"
"log"
"net/http"
)
func d(res http.ResponseWriter, req *http.Request) {
io.WriteString(res, "dog dog dog")