Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#define ORGINAL_FILE "/root/original_file"
#define DUPLICATE_FILE "/root/deplicate_file"
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdlib.h>
/* Function to write the data to the socket */
int write_socket (int socket_fd, const char* text)
{
@sudikrt
sudikrt / Delete_demo.apxc
Created August 14, 2017 08:22
Salesforce DML and its methods
Contact [] delContact = [SELECT Id FROM Contact where LastName = 'YLast'];
delete delContact;
System.debug(delContact);
@sudikrt
sudikrt / OpportunityAssignment_rudimmentry.apxc
Created August 24, 2017 06:11
Create one Object Reporting country . Create 3 fields country_code,country,capital. In object Account create field country_code. Now Create Lookup to Reporting country in Opportunity. Lets take example one record of Object Reporting country country_code country capital 91 India Delhi if In Account Object country_code = 91 then all opportunities …
public class Testhandler {
public static void handleTrigger (Map<Id, Account> newVal) {
Set<Decimal> cCode = new set<Decimal> ();
Map<Decimal, Reporting_country__c> ctrMap = new Map <Decimal, Reporting_country__c> ();
List<Opportunity> listToUpdate = new List<Opportunity> ();
for (Account a : newVal.values()) {
cCode.add (a.country_code__c);
}
@sudikrt
sudikrt / AddPrimaryContact.apxc
Created August 31, 2017 05:23
QuableApex Not worked
public class AddPrimaryContact implements Queueable {
Contact cont;
String statShort;
public AddPrimaryContact (Contact ct, String shortName) {
cont = ct;
statShort = shortName;
}
public void execute (QueueableContext queue ) {
List<Contact> updateList = new List<Contact> ();
<apex:page >
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page: tabbedAccount
<!-- End Default Content REMOVE THIS -->
<apex:tabPanel switchType="client" selectedTab="name2" id="tabpanel">
<apex:tab label="One" id="tabone" title="Some One" name="name1">Content for tab 1</apex:tab>
<apex:tab label="Two" id="tabtwo" title="Some Two" name="name2">Content for tab 2</apex:tab>
</apex:tabPanel>
Http http = new Http ();
HttpRequest req = new HttpRequest ();
req.setEndPoint ('https://th-apex-http-callout.herokuapp.com/animals');
req.setMethod ('POST');
req.setHeader ('Content-Type', 'application/json;charset=UTF-8');
req.setBody ('{"name":"mighty moose _1"}');
HttpResponse response = http.send(req);
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
@sudikrt
sudikrt / facebook--posts-deleter-2016-firefox-greasemonkey.js
Created November 25, 2017 03:46 — forked from vsubhash/com.vsubhash.js.facebook-posts-deleter
"Facebook Posts Deleter 2016" script is a Greasemonkey JavaScript that will automatically delete Facebook posts one by one without any user intervention. Install this script in Firefox using the Greasemonkey add-on. Then, go to your "Activity Log" and click on the "Delete Facebook Posts" that pops on the top-left.
// ==UserScript==
// @name Facebook Posts Deleter 2016
// @namespace com.vsubhash.js.facebook_posts_deleter.2016
// @description Automatically deletes posts from Activity Log of Facebook, one by one.
// @include https://www.facebook.com/*=allactivity
// @version 1
// @grant none
// ==/UserScript==
document.addEventListener("DOMContentLoaded",
#table-wrapper {
position:relative;
}
#table-scroll {
height:150px;
overflow:auto;
margin-top:20px;
}
#table-wrapper table {
width:100%;
@sudikrt
sudikrt / EmailValidator.kt
Created May 13, 2018 08:54 — forked from ironic-name/EmailValidator.kt
Kotlin regex email validator function
fun isEmailValid(email: String): Boolean {
return Pattern.compile(
"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]|[\\w-]{2,}))@"
+ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
+ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9]))|"
+ "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$"
).matcher(email).matches()
}