Skip to content

Instantly share code, notes, and snippets.

View dinukasal's full-sized avatar
💭
dinuksal.github.io

Dinuka Salwathura dinukasal

💭
dinuksal.github.io
View GitHub Profile
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
@dinukasal
dinukasal / clean.sh
Created August 6, 2020 06:32
clean ubuntu vm trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@dinukasal
dinukasal / http.ino
Created June 8, 2020 03:47
esp8266-201 http
/*********
Rui Santos
Complete project details at http://randomnerdtutorials.com
*********/
// Load Wi-Fi library
#include <ESP8266WiFi.h>
// Replace with your network credentials
const char* ssid = "Dialog 4G 899";
@dinukasal
dinukasal / count_string_occurence.py
Last active January 6, 2020 09:25
Count similar strings in an array of strings
import csv
import pandas as pd
lines = []
with open('search_kpi.csv') as csvfile:
readCSV = csv.reader(x.replace('\0', '') for x in csvfile)
for row in readCSV:
lines.append(row[1])
@dinukasal
dinukasal / .gitlab-ci.yml
Last active June 2, 2019 06:45
gitlab ci for building and pushing react app to google cloud(gcloud) storage
image: nikolaik/python-nodejs:latest
before_script:
# Install CA certs, openssl to https downloads, python for gcloud sdk
- apt install -y make ca-certificates openssl python
- update-ca-certificates
# Download and install Google Cloud SDK
- wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
- tar zxvf google-cloud-sdk.tar.gz && ./google-cloud-sdk/install.sh --usage-reporting=false --path-update=true
- google-cloud-sdk/bin/gcloud --quiet components update
@dinukasal
dinukasal / switch-php.sh
Created February 3, 2019 14:10
Bash script to switch php version between 5.6 and 7.0
echo Enter php version
echo 1: v7.0 to v5.6
echo 2: v5.6 to v7.0
echo
read v
if [[ "$v" == 1 ]]
then
echo changing php from v7.0 to v5.6
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
* use git for version controlling
* use meaningful variable names
* separate function into smaller function if function has more than 10 lines
* always try to seperate classes into separate modules
* use file per class
* maintain file line count under 1000
*
@dinukasal
dinukasal / tech_resources
Created May 8, 2018 05:39
Technical Resources
https://techtalk.gfi.com/top-20-free-digital-forensic-investigation-tools-for-sysadmins/
https://github.com/s1gh/ctf-literature
@dinukasal
dinukasal / .gitlab-ci.yml
Created February 4, 2018 14:28
Gitlab CI for react-native builds
image: openjdk:8-jdk
# image: jangrewe/gitlab-ci-android
variables:
ANDROID_COMPILE_SDK: "23"
ANDROID_BUILD_TOOLS: "23.0.1"
ANDROID_SDK_TOOLS: "3859397"
before_script:
@dinukasal
dinukasal / listen_udp.sh
Created November 16, 2017 06:05
Capture all udp packets on eth0
sudo tcpdump -i eth0 udp -vv -X